// 示例 1:

// 输入: s = "anagram", t = "nagaram"
// 输出: true
// 示例 2:

// 输入: s = "rat", t = "car"
// 输出: false

// let s = "anagram", t = "nagaram"
let s = "rat", t = "car"
var isAnagram = function (s, t) {
    let arr = new Array(26).fill(0)
    if (s.length !== t.length) {
        return false
    }
    for (let i = 0; i < s.length; i++) {
        arr[s.codePointAt(i) - 'a'.codePointAt(0)]++
    }
    for (let j = 0; j < t.length; j++) {
        arr[t.codePointAt(j) - 'a'.codePointAt(0)]--
    }
    for (let k = 0; k < arr.length; k++) {
        if (arr[k] !== 0) return false
    }
    return true
};
console.log(isAnagram(s, t));
